package com.steven.download.utils;

import android.util.Log;

import java.util.Calendar;

/**
 * @Des:
 * @Author: hwz
 * @Date:2021/11/15 0015
 * @Version: 1.0
 */
public class DateUtil {

    /**
     * 获取当前是见与晚上0点的时间差
     * @return
     */
    public static long getCurrentTo12Millis(){
        Calendar calendar = Calendar.getInstance();
        calendar.add(Calendar.DAY_OF_YEAR,1);
        calendar.set(Calendar.HOUR_OF_DAY,0);
        calendar.set(Calendar.SECOND,0);
        calendar.set(Calendar.MINUTE,0);
        calendar.set(Calendar.MILLISECOND,0);

        //当前时间与晚上十二点的毫秒差
//        Long timeOut = (calendar.getTimeInMillis()-System.currentTimeMillis()) / 1000;
        Long timeOut = (calendar.getTimeInMillis()-System.currentTimeMillis());
        //当前时间与晚上十二点的分钟差
        Long secondTimeOut = (calendar.getTimeInMillis()-System.currentTimeMillis()) / (1000*60);

        Log.e("ddd","当前时间与晚上十二点的毫秒差" + timeOut);
        Log.e("ddd","当前时间与晚上十二点的分钟差"+secondTimeOut);
        return timeOut;
    }
}
